﻿using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WebApplication1.Intf;

namespace WebApplication1.Hubs
{
    public class ChatHub : Hub
    {
        public void Send(string user,string message)
        {
            Clients.User(user).SendAsync("broadcast", $"{user}:{message}");
        }
        public void Join(string nickname)
        {
            Clients.Others.SendAsync("broadcast", $"{nickname} 加入了聊天室");

        }
    }
}
